#include "structEdge.hpp"
#include "structMesh.hpp"
#include "structMeshFunctions.hpp"
#include "geometry.hpp"

namespace hms {

StructEdge::StructEdge(	const StructMesh& mesh, Index i ) :
	StructEdgeBase( mesh, i )
{}

auto StructEdge::lengthImp() const -> scalar {
	return m_mesh.edges().length(m_index);
}

auto StructEdge::normalImp() const -> NormalVector {
	return m_mesh.edges().normal(m_index);
}

auto StructEdge::midpointImp() const -> Vector2s {
	return 0.5 * (
		  m_mesh.vertex( vertices()[0] )
		+ m_mesh.vertex( vertices()[1] )
	);
}

auto StructEdge::intersectionImp() const -> Vector2s {
	return intersectionWithCentroids(*this);
}


}